package main

import (
	"fmt"
	"hystrix"
	"io/ioutil"
	"net/http"
)

func main() {
	datatest := []byte{}
	err := hystrix.Do("my_command", func() error {
		res, err := http.Get("www.baidu.com")
		if err != nil {
			return err
		}
		defer res.Body.Close()

		data, err := ioutil.ReadAll(res.Body)
		if err != nil {
			return err
		}
		datatest = data
		return nil
	}, func(err error) error {
		fmt.Println("任务失败")
		return nil
	})

}
